package com.example.zhangyang.andriodfirstapp;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.EditText;
import android.widget.Toast;


public class MainActivity extends AppCompatActivity {
    public static final String EXTRA_MESSAGE = "com.example.myfirstapp.MESSAGE";
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        setTextViewCustom("zhangyang");
    }
    //TODO:这个方法是用来跳转新的页面
   public void sendMessage (View view) {
       Intent intent = new Intent(this, DisplayMessageActivity.class);
       EditText editText = (EditText) findViewById(R.id.editText);
       String message = editText.getText().toString();
       intent.putExtra(EXTRA_MESSAGE,message);
       startActivity(intent);
   }
   //TODO:用来测试TODO工具使用情况
   public void setTextViewCustom(String str) {
       Toast.makeText(this, str, Toast.LENGTH_SHORT).show();
   }
}
